package com.tuanzi.loan.business.service.galaxycard.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.tuanzi.loan.core.aspect.Debug;

import com.tuanzi.loan.business.service.galaxycard.GalaxyCardUserInfoService;
import com.tuanzi.loan.vo.request.galaxycard.GalaxyCardUserInfoSearchRequest;
import com.tuanzi.loan.vo.response.galaxycard.GalaxyCardUserInfoSearchResponse;
import com.tuanzi.loan.business.repository.galaxycard.GalaxyCardUserInfoRepository;
import com.tuanzi.loan.core.vo.PageSearcher;
import org.springframework.data.domain.Page;
import java.util.Objects;

/**
 * 银河黑卡用户信息 ServiceImplement
 * @author JinRuiyang 2018/1/8 19:00:25
 */
@Debug
@Service
@Transactional
@Retryable(value = { RetryException.class })
public class GalaxyCardUserInfoServiceImpl implements GalaxyCardUserInfoService {

    @Autowired
    private GalaxyCardUserInfoRepository galaxycarduserinfoRepository;

    /**
     * GalaxyCardUserInfo查询
     * @param pageSearcher 请求信息
     * @return 响应列表
     */
    public Page<GalaxyCardUserInfoSearchResponse> list(PageSearcher<GalaxyCardUserInfoSearchRequest> pageSearcher) {
        if (Objects.isNull(pageSearcher))
            throw new NullPointerException("pageSearcher is null");
        if (Objects.isNull(pageSearcher.getSearchCondition()) || Objects.isNull(pageSearcher.getPageable()))
            throw new NullPointerException("galaxycarduserinfoSearchRequest or pageable is null");
        return galaxycarduserinfoRepository.list(pageSearcher.getSearchCondition(),pageSearcher.getPageable());
    }
}